package com.jy.modules.cims.component.credit.creditor.transferor;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.jy.modules.cims.common.CimsConstant;
import com.jy.modules.cims.data.dto.CreditDetailDto;
import com.jy.modules.cims.data.dto.credit.CreditApplyDto;
import com.jy.modules.cims.data.dto.credit.CreditApplyResultDto;

/**
 * @description 抽象的债权转出处理实现类组件。。
 * @author shengzhoutao
 * @date 2015-07-07
 */
public abstract class AbstractCreditorTransferorDeal implements ICreditorTransferorDeal {
	private static final Logger logger = LoggerFactory.getLogger(AbstractCreditorTransferorDeal.class);

	/**
	 * @description 接受申请
	 * @param applyDto
	 *            债权申请实体
	 */
	public void receiveApply(CreditApplyDto applyDto) throws Exception {
		logger.info("====================receiveApply====================");
	}

	/**
	 * @description 获取数据结果
	 * @param dataMap
	 *            数据存放MAP
	 * @return 债权申请结果实体
	 * @throws Exception
	 */
	@SuppressWarnings("unchecked")
	public CreditApplyResultDto getMatchedResult(Map<String, Object> dataMap) throws Exception {
		logger.info("====================getMatchedResult====================");
		CreditApplyResultDto result = new CreditApplyResultDto();
		String dataType = dataMap.get("dataType") == null ? "" : dataMap.get("dataType").toString();
		Object dataIdObj = dataMap.get("dataId");

		if (null != dataIdObj) {
			List<CreditDetailDto> creditDetailList = new ArrayList<CreditDetailDto>();
			if (CimsConstant.SESSION_IMPORT_DATA_PATH.equals(dataType)) {
				creditDetailList = (List<CreditDetailDto>) dataMap.get("data");
			} else if (CimsConstant.REDIS_IMPORT_DATA_PATH.equals(dataType)) {

			}

			result.setCreditDetailList(creditDetailList);
		}
		return result;
	}

	/**
	 * @description 发送申请结果
	 * @param applyDto
	 *            债权申请实体
	 * @throws Exception
	 */
	public void sendApplyResultToConsult(CreditApplyDto applyDto) throws Exception {
		logger.info("====================sendApplyResultToConsult====================");
	}

	/**
	 * @description 确认申请结果
	 * @param applyDto
	 *            债权申请实体
	 * @param applyResultDto
	 *            债权申请结果实体
	 * @throws Exception
	 */
	public void confirmApplyResult(CreditApplyDto applyDto, CreditApplyResultDto applyResultDto) throws Exception {
		logger.info("====================confirmApplyResult====================");
	}
}
